package us.mooresr.geartrack.shared.model;

import java.io.Serializable;
import java.lang.Long;
import java.util.Date;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Subclass;

/**
 * An instance of a loan, including who borrowed what when, and when/if it was returned.
 * 
 * @author christopher_moore
 *
 */
@Subclass
public class Loan extends DatastoreObject implements Serializable {

	private static final long serialVersionUID = 2954379369339320123L;
	private Date checkOutDate;
	private Date checkInDate;
	private Key<Person> borrower;
	private Key<Item> item;

	public Loan() {
	}

	public void setCheckOutDate(Date checkOutDate) {
		this.checkOutDate = checkOutDate;
	}

	public void setCheckInDate(Date checkInDate) {
		this.checkInDate = checkInDate;
	}

	public void setBorrowerId(Long borrowerId) {
		this.borrower = new Key<Person>(Person.class, borrowerId);
	}

	public Date getCheckOutDate() {
		return checkOutDate;
	}

	public Date getCheckInDate() {
		return checkInDate;
	}

	public Long getBorrowerId() {
		return borrower.getId();
	}

	public Long getItemId() {
		return item.getId();
	}

	public void setItemId(Long itemId) {
		this.item = new Key<Item>(Item.class, itemId);
	}

	public Key<Person> getBorrower() {
		return borrower;
	}

	public void setBorrower(Key<Person> borrower) {
		this.borrower = borrower;
	}

	public Key<Item> getItem() {
		return item;
	}

	public void setItem(Key<Item> item) {
		this.item = item;
	}
	
	
	
}
